# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.pro>

_realname=sphinx-tabs
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=3.4.1
pkgrel=2
pkgdesc=" Tabbed views for Sphinx (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64')
license=('MIT')
url='https://github.com/executablebooks/sphinx-tabs'
depends=("${MINGW_PACKAGE_PREFIX}-python"
         "${MINGW_PACKAGE_PREFIX}-python-sphinx")
makedepends=("${MINGW_PACKAGE_PREFIX}-python-setuptools")
options=('staticlibs')
source=("${_realname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('a7ccc8fe4adf0c7957e84a59a5b536ef07da73fcebaf2f727adc3bee9062289d')

prepare() {
  cd "${srcdir}/${_realname}-${pkgver}"

  rm -rf "${srcdir}/python-build-${MSYSTEM}" | true
  cp -r "${srcdir}/${_realname}-${pkgver}" "${srcdir}/python-build-${MSYSTEM}"
}

build() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python setup.py build
}

check() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  ${MINGW_PREFIX}/bin/python setup.py test
}

package() {
  cd "${srcdir}/python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python setup.py install --prefix=${MINGW_PREFIX} --root="${pkgdir}" -O1 --skip-build

  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
